package com.xc.hotelmgr.order.modules.mt.controller;

import com.alibaba.fastjson.JSONObject;
import com.xc.hotelmgr.order.common.utils.MtR;
import com.xc.hotelmgr.order.modules.mt.service.MtStatusChangeCallbackService;
import com.xc.hotelmgr.order.modules.mt.to.notice.Notice;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("order")
@Slf4j
public class MtCallBack {
    @Autowired
    private MtStatusChangeCallbackService mtStatusChangeCallbackService;

    @RequestMapping(value = "status", method = RequestMethod.POST)
//    public MtR statusChange(@RequestBody Notice notice){
    public MtR statusChange(@RequestBody JSONObject jsonObject){
        log.info("======notice==={}",jsonObject);
//        MtR mtR =  mtStatusChangeCallbackService.doChange(notice);
        JSONObject dataObject = jsonObject.getJSONObject("data");
        MtR mtR =  mtStatusChangeCallbackService.doChangeJson(dataObject);

        return mtR;
    }
}
